package com.huawei.appgallery.forum.user.usercenter.activity;

import android.app.ActionBar;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.forum.base.api.IUserStateChange;
import com.huawei.appgallery.forum.base.ui.ForumActivity;
import com.huawei.appgallery.forum.user.api.IUserFollowProtocol;
import com.huawei.appgallery.forum.user.api.IUserFollowResult;
import com.huawei.hmf.annotation.ActivityDefine;
import o.azb;
import o.bqx;
import o.bsm;
import o.cbb.c;
import o.cbb.d;
import o.cbb.j;
import o.cgv;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjm;
import o.FragmentTransaction;

@ActivityDefine(alias = "forum.user.follow", protocol = IUserFollowProtocol.class, result = IUserFollowResult.class)
public class UserFollowActivity extends ForumActivity implements bsm {
    private int ʻॱ;
    private String ˋॱ;
    private boolean ͺ;
    private TextView ॱˊ;
    private int ॱˋ = 0;
    private IUserStateChange ᐝॱ = ((IUserStateChange) fho.ˏ().ˋ("Base").ॱ(IUserStateChange.class));

    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        setContentView(d.ʼ);
        this.ˋॱ = "";
        ᐝ();
        IUserFollowProtocol iUserFollowProtocol = (IUserFollowProtocol) this.ˏॱ.ॱ();
        String uri = iUserFollowProtocol.getUri();
        this.ॱˋ = iUserFollowProtocol.getFocus();
        this.ʻॱ = iUserFollowProtocol.getUserType();
        ˎ(uri);
        this.ͺ = 1 == iUserFollowProtocol.getUserType();
        if (this.ͺ) {
            this.ᐝॱ.ˊ("UserFollowActivity", new IUserStateChange.d(this) {
                final /* synthetic */ UserFollowActivity ˋ;

                {
                    this.ˋ = r1;
                }

                public void ॱ(int i) {
                    if (i == 1) {
                        bqx.ˊ("UserFollowActivity", "It's mine page, finish when logout");
                        this.ˋ.finish();
                    }
                }
            });
        }
    }

    private void ᐝ() {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        View findViewById = findViewById(b.ˉ);
        azb.ˏ(findViewById);
        this.ॱˊ = (TextView) findViewById.findViewById(b.ʽˊ);
        findViewById(b.ˋˊ).setVisibility(8);
        this.ॱˊ.setText(this.ˋॱ);
        cgv.ˋ(this, c.ॱ, c.ᐝ);
        findViewById(b.ˊˋ).setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ UserFollowActivity ˋ;

            {
                this.ˋ = r1;
            }

            public void onClick(View view) {
                this.ˋ.onBackPressed();
            }
        });
    }

    private void ˎ(String str) {
        fjb ˎ = fho.ˏ().ˋ("User").ˎ("forumUserFollowFragment");
        IUserFollowProtocol iUserFollowProtocol = (IUserFollowProtocol) ˎ.ˊ();
        iUserFollowProtocol.setUri(str);
        iUserFollowProtocol.setFocus(this.ॱˋ);
        iUserFollowProtocol.setDomainId(iUserFollowProtocol.getDomainId());
        iUserFollowProtocol.setUserType(this.ʻॱ);
        iUserFollowProtocol.setIgnoreTitle(false);
        fjm ˏ = fjm.ˏ(fiu.ˊ().ˋ(this, ˎ));
        FragmentTransaction ˊ = ˏॱ().ˊ();
        ˊ.ˏ(b.ˊᐝ, ˏ.ˏ(), "user_following");
        ˊ.ˏ();
    }

    public void onDestroy() {
        super.onDestroy();
        if (this.ͺ) {
            this.ᐝॱ.ॱ("UserFollowActivity");
        }
    }

    public void ˏ(String str) {
        if (TextUtils.isEmpty(str)) {
            str = getString(j.ˎ);
        }
        if (TextUtils.isEmpty(this.ˋॱ) || getString(j.ˎ).equals(this.ˋॱ)) {
            this.ˋॱ = str;
            ActionBar actionBar = getActionBar();
            if (actionBar != null) {
                actionBar.hide();
            }
            if (this.ॱˊ != null) {
                this.ॱˊ.setText(str);
            }
        }
    }
}
